package com.ndp.fb.rdb.api;


import com.ndp.fb.rdb.model.User;
import com.ndp.fb.rdb.model.UserExt;

import java.util.List;

/**
 * 用户表接口
 * Created by Jacky on 2015/1/22.
 */
public interface UserRdbServices {


    User findByEmail(String name);

    User findByUsername(String name);

    Long save(User user);

    void update(User user);

     User getAdminUserByOrgId(Long orgId);

     User getUserByTicket(String ticket);

    List<User> getAllUsers();
    List<UserExt> getAllUserExts();

    List<User> getAllUsersByOrgId(Long orgId);

    //通过用户获取他的角色id
    List<Long> getRoleByUser(Long userId);

    //保存用户-角色 一对多关系表
    void saveUserRole(Long userId, Long roleId);
    void update(String userId,Long spent,int effective_img_num,int hot_img_num,Long effective_img_spent);

    List<User> findByOrgIdAndConnectionOnjectId(Long orgId, Long fbConnectionObjectId);

    List<UserExt> getAllUserExtsByOrgId(Long orgId);

    /**
     * 查询企业下的所有人员信息，忽略自己
     * @param usernameOrEmailStr
     * @param userid
     * @param orgId
     * @return
     */
    List<User> findByUsernameOrEmail(String usernameOrEmailStr,String userid,Long orgId);

    void deleteUser(Long userId);
}
